]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspacesView: Skip relayouts during destruction
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 28 Aug 2023 17:44:11 +0000 (19:44 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 29 Aug 2023 18:35:26 +0000 (18:35 +0000)
The WorkspacesView may be scheduled to be destroyed during
relayout, and despite that go through the allocate() vfunc.
When that happens, the ::destroy handler is called early,
so the WorkspacesView clears this._workspaces in result.
When vfunc_allocate() is called, various paths rely on the
workspaces array being still populated, which is not the
case.

The existing check at vfunc_allocate() for the WorkspacesView
having no children is insufficient, since children are destroyed
as a result, not beforehand.

This results in the following warnings when going out of
overview:

JS ERROR: TypeError: workspace is undefined
_getSpacing@resource:///org/gnome/shell/ui/workspacesView.js:218:13
vfunc_allocate@resource:///org/gnome/shell/ui/workspacesView.js:344:18
vfunc_allocate@resource:///org/gnome/shell/ui/overviewControls.js:223:33
removeWindow@resource:///org/gnome/shell/ui/workspace.js:856:29
addWindow/<.destroyId<@resource:///org/gnome/shell/ui/workspace.js:808:22
_updateWorkspacesViews@resource:///org/gnome/shell/ui/workspacesView.js:1023:38
prepareToEnterOverview@resource:///org/gnome/shell/ui/workspacesView.js:990:14
prepareToEnterOverview@resource:///org/gnome/shell/ui/overviewControls.js:740:33
gestureBegin@resource:///org/gnome/shell/ui/overviewControls.js:802:14
_gestureBegin@resource:///org/gnome/shell/ui/overview.js:409:33
_beginGesture@resource:///org/gnome/shell/ui/swipeTracker.js:601:14
_handleEvent@resource:///org/gnome/shell/ui/swipeTracker.js:173:26
@resource:///org/gnome/shell/ui/init.js:21:20

This always happens through the _updateWorkspacesViews() paths, so there
is a new WorkspacesView taking over and the one being destroyed should
silently go away.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6935
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2918>

js/ui/workspacesView.js

index 363b73daf172ceca7aae712500f8b7845ad53388..b275f43df73d06a3f07e25c7eb95f19904846fdd 100644 (file)
@@ -331,7 +331,7 @@ class WorkspacesView extends WorkspacesViewBase {
     vfunc_allocate(box) {
         this.set_allocation(box);
 
-        if (this.get_n_children() === 0)
+        if (this._workspaces.length === 0)
             return;
 
         const vertical = global.workspaceManager.layout_rows === -1;